home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / Network / Anarchie-120 / Example Scripts / Download Files next >
Text File  |  1994-05-10  |  2KB  |  48 lines

  1. -- Change these to specify your prefered Umich & Info-Mac FTP sites.
  2. -- Don't use the home sites, as they are already overloaded.
  3. set umichaddr to "archie.au:/micros/mac/umich/"
  4. set infomacaddr to "archie.au:/micros/mac/info-mac/"
  5. -- Set this to the path to your download file that lists the files to fetch
  6. set theinput to "rocky:desktop folder:download"
  7.  
  8. set quitanarchie to false
  9.  
  10. set thedata to readtext file theinput
  11.  
  12. copy thedata & return to thedata
  13. set newdata to ""
  14. set i to 1
  15. repeat while i ≤ (the number of paragraphs of thedata)
  16.     set theurl to paragraph i of thedata
  17.     if length of theurl > 0 then
  18.         set keepit to true
  19.         if (theurl contains " /info-mac") and (theurl contains ";") then
  20.             copy ((characters (offset of "/info-mac" in theurl) thru ¬
  21.                 ((offset of ";" in theurl) - 1) of theurl) as string) to theurl
  22.         end if
  23.         if (theurl does not contain ":") and (theurl starts with "/mac/") then
  24.             copy umichaddr & text from character 6 of theurl to end of theurl to theurl
  25.         end if
  26.         if (theurl does not contain ":") and (theurl starts with "/info-mac/") then
  27.             copy infomacaddr & text from character 11 of theurl to end of theurl to theurl
  28.         end if
  29.         if theurl contains ":" then
  30.             tell application "Anarchie"
  31.                 set quitanarchie to true
  32.                 with timeout of 3600 seconds
  33.                     set err to fetch url theurl expand with "blah"
  34.                     set keepit to (err is not 0)
  35.                 end timeout
  36.             end tell
  37.         end if
  38.         if keepit then
  39.             copy (newdata & (paragraph i of thedata) & return) to newdata
  40.         end if
  41.     end if
  42.     set i to i + 1
  43. end repeat
  44.  
  45. writetext file theinput data newdata
  46.  
  47.  
  48.